<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">设置小程序昵称</div>
                            </div>
                            <div class="am-form-group">
                                <div class="tips am-margin-bottom-sm am-u-sm-12">
                                    {if isset($name['status']['value'])}
                                    <div class="{$name['status']['value'] == 0?'pre-warning':''} 
                                    {$name['status']['value'] == 1?'pre-success':''} 
                                    {$name['status']['value'] == 2?'pre-error':''}">
                                        <p>{$name['status']['value']} {$name['status']['value'] == 2?'：' . $name['reason'] :''}</p>
                                    </div>
                                    {/if}
                                </div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">小程序名称 </label>
                                <div class="am-u-sm-9 am-input-group">
                                    <div class="am-u-sm-7">
                                        <input id="nick_name" type="text" class="am-form-field" name="data[nick_name]"
                                               value="{$model['app_name']}" required>
                                    </div>
                                    <div class="am-u-sm-5 am-form-label am-text-left">
										<button id="btn-check" type="button" class="am-btn am-btn-success am-btn-xs"> 
											检测名称
										</button>
									</div>
                                    <div class="help-block am-u-sm-12">
                                        <small>小程序名称由中文、数字、英文及部分特殊符号组成。</small>
                                    </div>
									<div class="help-block am-u-sm-12">
                                        <small>长度在4-30个字符之间，一个中文字等于2个字符。</small>
                                    </div>
									<div class="help-block am-u-sm-12">
                                        <small>小程序发布前，昵称可修改2次，发布后只可通过认证方式改名。</small>
                                    </div>
                                </div>
                            </div>
							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label form-require">营业执照 </label>
								<div class="am-u-sm-9">
									<div class="am-form-file">
										<button type="button" class="upload-file-license am-btn am-btn-primary am-btn-xs">
											<i class="am-icon-cloud-upload"></i> 选择图片
										</button>
										<div class="uploader-list am-cf"></div>
									</div>
									<div class="help-block">
                                        <small>账号主体的营业执照，文件最大2Mb，支持jpeg/jpg格式</small>
                                    </div>
								</div>
							</div>
							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label">补充材料 </label>
								<div class="am-u-sm-9">
									<div class="am-form-file">
										<button type="button" class="upload-file-other1 am-btn am-btn-primary am-btn-xs">
											<i class="am-icon-cloud-upload"></i> 选择图片
										</button>
										<div class="uploader-list am-cf"></div>
									</div>
									<div class="help-block">
                                        <small>可不提交，如需名称保护，可提交和名称一致的商标证书或者提示需要补充的其他证明材料。文件最大2Mb，支持jpeg/jpg格式</small>
                                    </div>
								</div>
							</div>
							<div class="am-modal am-modal-loading am-modal-no-btn" tabindex="-1" id="my-modal-loading"></div>                        
                            {if !$name OR isset($name['status']) AND $name['status'] != 0}
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        {/if}
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 图片文件列表模板 -->
{include file="../addons/upload/view/template/tpl_file_item_url.html" /}
<!-- 文件库弹窗 -->
{include file="../addons/upload/view/template/file_library.html" /}
<script>
    $(function () {
		
		 // 检测名称
        $('#btn-check').click(function () {
			var nick_name = $('#nick_name').val();
			if(nick_name == ''){
				layer.msg('请输入小程序名称', {time: 1500, anim: 6});
				return false;
			}
			var url = "/applet/wxapp.name/checkName/nick_name/"+nick_name;
			$.get(url,function(result){
				layer.open({
					title: '检测结果'
					,content: result.msg
				});
			});
        });
		// 营业执照
		$('.upload-file-license').selectImages({
			name: 'data[license]'
		});
		// 补充材料
		$('.upload-file-other1').selectImages({
			name: 'data[naming_other_stuff_1]'
		});

        $('#my-form').formPost();
			
    });
</script>
